package me.zxk.qwert_poetry.dto.response;

import lombok.Data;
import me.zxk.qwert_poetry.dao.User;
import me.zxk.qwert_poetry.dto.SimpleUserDTO;

@Data
public class LoginResponseDTO {
    private String token;
    private SimpleUserDTO user;

    public static LoginResponseDTO fromEntity(User user, String token) {
        LoginResponseDTO dto = new LoginResponseDTO();
        dto.setToken(token);
        dto.setUser(SimpleUserDTO.fromEntity(user));
        return dto;
    }
}
